package kr.co.doriclassic.pro12;

public class Person implements Comparable {
	private String name;
	private int height;
	public Person(String name, int height) {
		this.name = name;
		this.height = height;
	}
	@Override
	public int compareTo(Object other) {
		return this.height - ((Person)other).height;
	}
	
	public void getMaximum(Person[] array){
		int maxHeight=0;
		
		for (int i = 0; i < array.length; i++) {
			if(array[maxHeight].compareTo(array[i])<0){
				maxHeight = i;
			}
		}
		System.out.println("키가 제일 큰 사람은 "+array[maxHeight].name+"이고 키는 "+array[maxHeight].height+"이다."); 
	}	
}
